function(){
            var currentPos;
            var historyArr;
            return {
                init: function () {
                    historyArr = [];
                    currentPos = 0;
                },
                add: function (token, preventDup) {
                    if (!preventDup || -1 == historyArr.indexOf(token)){
                        if (currentPos >= historyArr.length - 1){
                            historyArr.push(token);
                            currentPos = historyArr.length - 1;
                        }else{
                            historyArr.splice(currentPos + 1, 0, token);
                            currentPos = currentPos + 1;
                        }
                    }
                    // currentPos = historyArr.length-1;
                },
                isEmpty: function(){
                    return Ext.isEmpty(historyArr);
                },
                back: function(){
                    var lastPos = currentPos;
                    currentPos = (currentPos <= 0 ? 0 : (currentPos-1));
                    if (lastPos == currentPos){
                        return;
                    }
                    var token = historyArr[currentPos];
                    if (Ext.isEmpty(token)){
                        return;
                    }

                    if (historyArr[lastPos] == token){ // 如果一样，则继续向后寻找
                        this.back();
                        return;
                    }

                    var parts = token.split('#');
                    var nodePath = parts[1];
                    trees.historyOpenFlag = true;
                    trees.selectPath(nodePath);
                },
                forward: function(){
                    var lastPos = currentPos;
                    if (0 == historyArr.length-1){
                        currentPos = 0;
                    }else{
                        currentPos = (currentPos >= (historyArr.length-1) ? (historyArr.length-1) : (currentPos+1));
                    }
                    if (lastPos == currentPos){
                        return;
                    }
                    var token = historyArr[currentPos];

                    if (Ext.isEmpty(token)){
                        return;
                    }

                    if (historyArr[lastPos] == token){ // 如果一样，则继续向前寻找
                        this.forward();
                        return;
                    }

                    var parts = token.split('#');
                    var nodePath = parts[1];
                    trees.historyOpenFlag = true;
                    trees.selectPath(nodePath);
                }
            };
        }